# Contributor: Oleg Titov <oleg.titov@gmail.com>
# Maintainer: Oleg Titov <oleg.titov@gmail.com>
pkgname=py3-pypubsub
pkgver=4.0.3
pkgrel=0
pkgdesc="A Python publish-subcribe library"
url="https://github.com/schollii/pypubsub"
arch="noarch"
license="BSD-2-Clause"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
checkdepends="py3-pytest"
subpackages="$pkgname-doc $pkgname-pyc"
source="py3-pypubsub-$pkgver.tar.gz::https://github.com/schollii/pypubsub/archive/refs/tags/v$pkgver.tar.gz"
builddir="$srcdir/pypubsub-$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl

	# otherwise unable to read local data files from tests/suite/
	cd tests/suite/
	../../.testenv/bin/python3 -m pytest
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl

	install -Dm644 README.rst -t "$pkgdir"/usr/share/doc/$pkgname
}

sha512sums="
cf9aca44e91a5d0e5ecf6739deabf2980f9464395c89e3c5335c5248e47c570701e0534bb660c5005325a994d9f8e7f261f36bc8bea74cfc7eb760b73c572652  py3-pypubsub-4.0.3.tar.gz
"
